﻿@using Web.Core.Components
@using Ayatta.Contract.Domain
@using Ayatta.Common.Extension

@helper GetStepHtml(Order order)
    {
        var text = "买家下单";
        if (order.Category == OrderCategory.Auction)
        {
            text = "竞购获得";
        }
        if (order.Status == OrderStatus.Pending || order.Status == OrderStatus.WaitBuyerPay)
        {
    <div class="flowstep">
        <ul class="list-unstyled flowstep-5">
            <li class="step-first">
                <div class="step-cur">
                    <div class="step-name">
                        @text</div>
                    <div class="step-no">
                        1
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">@(order.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-name">
                    买家付款</div>
                <div class="step-no">
                    2</div>
                <div class="step-time">
                </div>
            </li>
            <li>
                <div class="step-name">
                    发货</div>
                <div class="step-no">
                    3</div>
            </li>
            <li>
                <div class="step-name">
                    买家确认收货</div>
                <div class="step-no">
                    4</div>
            </li>
            <li class="step-last">
                <div class="step-name">
                    评价</div>
                <div class="step-no">
                    5</div>
            </li>
        </ul>
    </div>
        }
        else if (order.Status == OrderStatus.WaitSellerSend)
        {
    <div class="flowstep">
        <ul class="list-unstyled flowstep-5">
            <li class="step-first">
                <div class="step-done">
                    <div class="step-name">
                        @text</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">@(order.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-cur">
                    <div class="step-name">
                        买家付款</div>
                    <div class="step-no">
                        2</div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.PaidOn.HasValue ? order.PaidOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-name">
                    发货</div>
                <div class="step-no">
                    3</div>
            </li>
            <li>
                <div class="step-name">
                    买家确认收货</div>
                <div class="step-no">
                    4</div>
            </li>
            <li class="step-last">
                <div class="step-name">
                    评价</div>
                <div class="step-no">
                    5</div>
            </li>
        </ul>
    </div>
        }
        else if (order.Status == OrderStatus.SellerSendPart)
        {
    <div class="flowstep">
        <ul class="list-unstyled flowstep-5">
            <li class="step-first">
                <div class="step-done">
                    <div class="step-name">
                        @text</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-done">
                    <div class="step-name">
                        买家付款</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.PaidOn.HasValue ? order.PaidOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-cur">
                    <div class="step-name">
                        部分发货</div>
                    <div class="step-no">
                        3
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.ConsignOn.HasValue ? order.ConsignOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-name">
                    买家确认收货</div>
                <div class="step-no">
                    4</div>
            </li>
            <li class="step-last">
                <div class="step-name">
                    评价</div>
                <div class="step-no">
                    5</div>
            </li>
        </ul>
    </div>
        }
        else if (order.Status == OrderStatus.WaitBuyerConfirm)
        {
    <div class="flowstep">
        <ul class="list-unstyled flowstep-5">
            <li class="step-first">
                <div class="step-done">
                    <div class="step-name">
                        @text</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-done">
                    <div class="step-name">
                        买家付款</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.PaidOn.HasValue ? order.PaidOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-cur">
                    <div class="step-name">
                        发货</div>
                    <div class="step-no">
                        3
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.ConsignOn.HasValue ? order.ConsignOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-name">
                    买家确认收货</div>
                <div class="step-no">
                    4</div>
            </li>
            <li class="step-last">
                <div class="step-name">
                    评价</div>
                <div class="step-no">
                    5</div>
            </li>
        </ul>
    </div>
        }
        else if (order.Status == OrderStatus.Finished)
        {
    <div class="flowstep">
        <ul class="list-unstyled flowstep-5">
            <li class="step-first">
                <div class="step-done">
                    <div class="step-name">
                        @text</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.CreatedOn.ToString("yyyy-MM-dd HH:mm:ss"))</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-done">
                    <div class="step-name">
                        买家付款</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.PaidOn.HasValue ? order.PaidOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-done">
                    <div class="step-name">
                        发货</div>
                    <div class="step-no">
                    </div>
                    <div class="step-time">
                        <div class="step-time-wraper">
                            @(order.ConsignOn.HasValue ? order.ConsignOn.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty)</div>
                    </div>
                </div>
            </li>
            <li>
                <div class="step-cur">
                    <div class="step-name">
                        买家确认收货</div>
                    <div class="step-no">
                        4
                    </div>
                </div>
            </li>
            <li class="step-last">
                <div class="step-name">
                    评价</div>
                <div class="step-no">
                    5</div>
            </li>
        </ul>
    </div>
        }
}
@helper GetStatusHtml(Order order, bool isSeller = false)
    {
        if (!isSeller)
        {
    <div class="ui-box-content">
        @if (order.Status == OrderStatus.Pending || order.Status == OrderStatus.WaitBuyerPay)
        {
            <div>
                <h5>
                    当前订单状态： 待付款，请在3天内付款；若未及时付款，系统将自动取消订单</h5>
                <p>
                    @if (order.Status == OrderStatus.Pending)
                    {
                        <a class="btn btn-danger"  style="margin-left: 50px;" href="/order/pay/@(order.Id)" target="_blank">
                            付 款</a>
                    }
                    else if (order.Status == OrderStatus.WaitBuyerPay)
                    {
                        <a class="btn btn-danger"  style="margin-left: 50px;" href="@(WebSite.Pay)/order?param=@(order.Id)"  target="_blank">
                            付 款</a>
                    }
                    <a data-trigger="modal" href="/order/cancel/@(order.Id)" data-title="取消订单" class="btn"
                               style="margin-left: 20px;">取消订单</a> <a data-trigger="modal" href="/order/memo/@(order.Id.Trim())"
                                                                      data-title="备忘" class="btn" style="margin-left: 20px;">
                                   备 忘</a>
                </p>
                @if (!order.BuyerMemo.IsNullOrEmpty())
                {
                    <div class="alert alert-info">
                        <strong>备 忘：</strong> @(order.BuyerMemo)
                    </div>
                }
            </div>
        }
        else if (order.Status == OrderStatus.WaitSellerSend)
        {
            <div>
                <h5>
                    当前订单状态： 您已付款，等待商家发货；您可以联系商家确认发货时间。</h5>
                <p>
                    付款24小时后如果卖家一直不发货，您可以联系卖家或 提醒卖家发货 如果卖家存在违背发货时间承诺的情况（什么是违背发货时间承诺），您也不想再要货物，您可以 申请退款
                    查看退款流程和规则 对于卖家没有履行承诺的情况，如需投诉，您可以在退款成功后投诉维权
                </p>
                <p>
                    <a data-trigger="modal" href="/order/memo/@(order.Id)"
                                                                      data-title="备忘" class="btn btn-default" style="margin-left: 20px;">
                        提醒卖家发货（付款24小时后）</a> <a data-trigger="modal" href="/order/memo/@(order.Id)"
                                                                      data-title="备忘" class="btn btn-default" style="margin-left: 20px;">
                            申请退款</a> <a data-trigger="modal" href="/order/memo/@(order.Id)"
                                                                      data-title="备忘" class="btn btn-default" style="margin-left: 20px;">
                                备 忘</a>
                </p>
                @if (!order.BuyerMemo.IsNullOrEmpty())
                {
                    <div class="alert alert-info">
                        <strong>备 忘：</strong> @(order.BuyerMemo)
                    </div>
                }
            </div>
        }
        else if (order.Status == OrderStatus.SellerSendPart)
        {
            <div>
                <h5>
                    当前订单状态： 您已付款，卖家已部分发货。</h5>
                <p>
                    付款24小时后如果卖家一直不发货，您可以联系卖家或 提醒卖家发货 如果卖家存在违背发货时间承诺的情况（什么是违背发货时间承诺），您也不想再要货物，您可以 申请退款
                    查看退款流程和规则 对于卖家没有履行承诺的情况，如需投诉，您可以在退款成功后投诉维权
                </p>
                <p>
                    <a data-trigger="modal" href="/order/memo/@(order.Id)"
                                                                      data-title="备忘" class="btn" style="margin-left: 20px;">
                        提醒卖家发货（付款24小时后）</a> <a data-trigger="modal" href="/order/memo/@(order.Id)"
                                                                      data-title="备忘" class="btn" style="margin-left: 20px;">
                            备 忘</a>
                </p>
                @if (!order.BuyerMemo.IsNullOrEmpty())
                {
                    <div class="alert alert-info">
                        <strong>备 忘：</strong> @(order.BuyerMemo)
                    </div>
                }
            </div>
        }
        else if (order.Status == OrderStatus.WaitBuyerConfirm)
        {
            <div>
                <h5>
                    当前订单状态： 商家已发货，等待确认收货</h5>
                <p>
                    如果您已收到货，且对商品满意，您可以 确认收货</p>
                <p>
                    如果已收到货，但商品有问题，您可以联系卖家 申请退款 查看退款流程和规则</p>
                <p>
                    @if (!order.MultipleConsign)
                    {
                        <a data-trigger="confirm" data-content="<p><strong>我已收到货。</strong></p><p>请收到货后，再确认收货！</p> <p>如果您想申请退款，请点击这里。</p>" href="/order/confirm/@(order.Id)"  class="btn btn-danger"
                           style="margin-left: 20px;">确认收货</a>}
                    <a data-trigger="modal" href="/order/memo/@(order.Id)"
                                                                  data-title="备忘" class="btn" style="margin-left: 20px;">
                        备 忘</a>
                </p>
                @if (!order.BuyerMemo.IsNullOrEmpty())
                {
                    <div class="alert alert-info">
                        <strong>备 忘：</strong> @(order.BuyerMemo)
                    </div>
                }
            </div>
        }
        else if (order.Status == OrderStatus.Canceled)
        {
            <div>
                <h5>
                    当前订单状态： 交易关闭
                </h5>
                @if (order.Cancel.HasValue)
                {
                    if (order.Cancel.Value == 0)
                    {
                    <p>
                        系统取消订单</p>
                    }
                    else if (order.Cancel.Value == 1)
                    {
                    <p>
                        买家取消订单</p>
                    }
                    else if (order.Cancel.Value == 2)
                    {
                    <p>
                        卖家取消订单</p>
                    }
                    <p>
                        取消原因： @(order.CancelReason)</p>
                }
                <p>
                    <a data-trigger="modal" href="/order/memo/@(order.Id)" data-title="备忘" class="btn" style="margin-left: 20px;">
                        备 忘</a>
                </p>
                @if (!order.BuyerMemo.IsNullOrEmpty())
                {
                    <div class="alert alert-info">
                        <strong>备 忘：</strong> @(order.BuyerMemo)
                    </div>
                }
            </div>
        }
        else if (order.Status == OrderStatus.Finished)
        {
            <div>
                <h5>
                    当前订单状态： 交易成功
                </h5>
                <ol>
                    @if (!order.BuyerRate)
                    {
                        <li>
                            <p>
                                交易成功，请给卖家 评价。</p>
                        </li>
                    }
                    <li>
                        <p>
                            如果没有收到货，或收到货后出现问题，您可以联系卖家协商解决。</p>
                    </li>
                    <li>
                        <p>
                            如果卖家没有履行应尽的承诺，您可以“投诉维权”。</p>
                    </li>
                </ol>
                <p>
                    <a data-trigger="modal" href="/order/memo/@(order.Id)" data-title="备忘" class="btn" style="margin-left: 20px;">
                        备 忘</a>
                </p>
                @if (!order.BuyerMemo.IsNullOrEmpty())
                {
                    <div class="alert alert-info">
                        <strong>备 忘：</strong> @(order.BuyerMemo)
                    </div>
                }
            </div>
        }
    </div>
        }
}